import javax.swing.*;
import java.awt.*;

public class MyStartPanel extends JPanel implements Runnable {

    private int times = 0;

    public void paint(Graphics graphics) {
        super.paint(graphics);

        graphics.fillRect(0, 0, 400, 300);
        //提示信息
        if (times % 2 == 0) {
            graphics.setColor(Color.yellow);
            //开关信息的字体
            Font font = new Font("华文新魏", Font.BOLD, 30);
            graphics.setFont(font);
            graphics.drawString("stage: 1", 150, 150);

        }
    }

    @Override
    public void run() {
        while (true) {
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

            times++;
            this.repaint();
        }
    }
}
